package com.bjpowernode.crm.workbench.service.impl;

import com.bjpowernode.crm.commons.utils.DateUtils;
import com.bjpowernode.crm.commons.utils.UUIDUtils;
import com.bjpowernode.crm.workbench.domain.ActivityRemark;
import com.bjpowernode.crm.workbench.mapper.ActivityRemarkMapper;
import com.bjpowernode.crm.workbench.service.ActivityRemarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 郭俊才
 * 2021/8/24
 */
@Service
public class ActivityRemarkServiceImpl implements ActivityRemarkService {
    @Autowired
    private ActivityRemarkMapper activityRemarkMapper;
    @Override
    public int saveSelective(ActivityRemark activityRemark) {
        //设置UUID主键
        activityRemark.setId(UUIDUtils.getUUID());
        //设置创建时间
        activityRemark.setCreateTime(DateUtils.formatDateTime(new Date()));
        //设置编辑状态
        activityRemark.setEditFlag("1");
        return activityRemarkMapper.insertSelective(activityRemark);
    }

    @Override
    public int removeByPrimaryKey(String id) {
        return activityRemarkMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int editByPrimaryKeySelective(ActivityRemark activityRemark) {
        //设置修改时间
        activityRemark.setEditTime(DateUtils.formatDateTime(new Date()));
        //设置修改状态
        activityRemark.setEditFlag("0");
        return activityRemarkMapper.updateByPrimaryKeySelective(activityRemark);
    }

    @Override
    public ActivityRemark queryByPrimaryKey(String id) {
        return activityRemarkMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<ActivityRemark> queryByConditions(ActivityRemark activityRemark) {
        return activityRemarkMapper.selectByConditions(activityRemark);
    }
}
